/*

This file is part of Ext JS 4

Copyright (c) 2011 Sencha Inc

Contact:  http://www.sencha.com/contact

Commercial Usage
Licensees holding valid commercial licenses may use this file in accordance with the Commercial Software License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Sencha.

If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.

*/
Ext.require([
	'Ext.menu.*',
	'Ext.QuickTips.*',
	'Ext.toolbar.*',
	
]);

// TODO: The "Users" menu containing buttons is completely screwed: ButtonGroup needs work.

function pdm_menu(){
	Ext.onReady(function(){
		Ext.QuickTips.init();     
		
		var menu = Ext.create('Ext.menu.Menu', {
			id: 'mainMenu',
			style: {
				overflow: 'visible'     // For the Combo popup
			},
			items: [
			{
					text: 'Radio Options',
					menu: {        // <-- submenu by nested config object
						items: [
							// stick any markup in a menu
							'<b class="menu-title">Choose a Theme</b>',
							{
								text: 'Aero Glass',
								checked: true,
								group: 'theme',                            
							}, {
								text: 'Vista Black',
								checked: false,
								group: 'theme',                            
							}, {
								text: 'Gray Theme',
								checked: false,
								group: 'theme',                            
							}, {
								text: 'Default Theme',
								checked: false,
								group: 'theme',                            
							}
						]
					}
			   }
			]
		});
		
		
		var tb = Ext.create('Ext.toolbar.Toolbar');
		tb.suspendLayout = true;
		//~ tb.render('toolbar');

		tb.add({
				text:'Button w/ Menu',
				iconCls: 'bmenu',  // <-- icon
				menu: menu  // assign menu by instance
			}, {
				text: 'Users',
				iconCls: 'user',
				menu: {
					xtype: 'menu',
					plain: true,
					items: {
						xtype: 'buttongroup',
						title: 'User options',
						columns: 2,
						defaults: {
							xtype: 'button',
							scale: 'large',
							iconAlign: 'left'
						},
						items: [{
							text: 'User<br/>manager',
							iconCls: 'edit',
							width: 90
						},{
							iconCls: 'add',
							width: 'auto',
							tooltip: 'Add user',
							width: 40
						},{
							colspan: 2,
							text: 'Import',
							scale: 'small',
							width: 130
						},{
							colspan: 2,
							text: 'Who is online?',
							scale: 'small',
							width: 130
						}]
					}
				}
			});

	});
}
